package com.gaogzhen.designPattern.guardedSuspension;

import lombok.extern.slf4j.Slf4j;

/**
 * 邮递员
 */
@Slf4j(topic = "d.Postman")
public class Postman implements Runnable{
    private String identifier;
    private String mail;

    public Postman(String identifier, String mail) {
        this.identifier = identifier;
        this.mail = mail;
    }

    @Override
    public void run() {
        // 送信件
        log.debug("信已送到，居民编号：{}", identifier);
        GuardedDecouple letter = MailBoxes.getLetter(identifier);
        letter.setResponse(mail);
        MailBoxes.setLetter(letter);

    }
}
